<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>修改库存地址</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <style type="text/css">
        .detail {
            padding-right: 20px!important;
        }

        h5 {
            color: #0062CC;
        }

        .mui-navigate-right .mui-col-xs-8 {
            width: 62.666667%!important;
        }

        .mui-text-right input,
        .mui-text-right textarea {
            border: 0;
            font-size: 14px;
            font-weight: 400;
            color: #8f8f94;
            margin-bottom: 0;
            text-align: right;
        }
    </style>
</head>

<body>
    <div class="mui-content">
        <ul class="mui-table-view mui-table-view-chevron">
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">当前库存地址：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="binnum"></span>
                    </div>
                </div>
            </li>
            <!-- 改为手动输入地址 <li class="mui-table-view-cell detail" tapmode onclick="openSaveWin('work_order_sel_stockaddress','选择库存地址')"> -->
            <li class="mui-table-view-cell detail">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">更新库存地址：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <input type="text" placeholder="请输入库存地址" id="stockName">
                        <!-- 改为手动输入地址 <span class="mui-h5" id="stockName">请选择新库存地址</span> -->
                    </div>
                </div>
            </li>
        </ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    var stockId;
    apiready = function() {
        onLoadData(curPage, false);
        // api.addEventListener({
        //     name: 'binnumId'
        // }, function(ret, err) {
        //     stockId = ret.value.binnum;
        //     $api.html($api.byId('stockName'), ret.value.binnum)
        // });
        api.parseTapmode();
        api.addEventListener({
            name: 'navitembtn'
        }, function(ret, err) {
            if (ret.index == 0) {
                if ($api.val($api.byId('stockName')) == '') {
                    Toast('请选择库存地址！');
                    return
                }
                ajaxrd("updateLocationAddress", {
                    itemnum: api.pageParam.itemnum,
                    binnum: $api.val($api.byId('stockName'))
                    // binnum: stockId 改为手动输入地址
                }, function(ret, err) {
                    api.sendEvent({
                        name: 'refersh',
                        extra: {
                            isrefersh: 'yes'
                        }
                    });
                    Toast('操作成功！');
                    setTimeout(function() {
                        api.closeWin();
                    }, 500)
                })
            } else { //扫码

            }
        });
    }

    function onLoadData(page, load) {
        ajaxrd("queryCurBal", {
            itemnum: api.pageParam.itemnum,
            location: api.pageParam.locations
        }, function(ret, err) {
            api.refreshHeaderLoadDone();
            $api.text($api.byId('binnum'), ret.binnum);
        })
    }
</script>

</html>
